home *** CD-ROM | disk | FTP | other *** search
/ Mac Expert 1995 Winter / Mac Expert - Winter 95.iso / Les fichiers / Communications / Internet / TurboTCP 2.1 ƒ / PP MiniTelnet source / CTelnetTerminal.h < prev    next >
Encoding:
Text File  |  1995-01-19  |  2.7 KB  |  109 lines  |  [TEXT/MMCC]

  1. //
  2. // CTelnetTerminal.h
  3. //
  4. //    MiniTelnet application
  5. //    Telnet session document
  6. //    PowerPlant version
  7. //
  8. //    Copyright © 1993-95, FrostByte Design / Eric Scouten
  9. //
  10.  
  11. #pragma once
  12.  
  13. #include <LSingleDoc.h>
  14. #include "CTelnetInterp.h"
  15.  
  16. #include "MiniTelnet.const.h"
  17.  
  18. class CTerminalPane;
  19.  
  20.  
  21.  
  22. //***********************************************************
  23.  
  24. class CTelnetTerminal : public LSingleDoc, public CTelnetInterp {
  25.  
  26. // This class implements the behavior of a terminal connected to Telnet. It uses the
  27. // CTerminalPane class to draw the terminal screen. It handles all user events (such as
  28. // key-downs) and interacts with CTCPStream to process them.
  29.  
  30. // Some debugging methods are included so that the “behind-the-scenes” negotiation of
  31. // Telnet can be viewed on-screen.
  32.  
  33. public:
  34.                     CTelnetTerminal(LCommander* inSuper,
  35.                         unsigned short theDefaultPort,
  36.                         unsigned long recBufferSize = recReceiveSize,
  37.                         unsigned short autoReceiveSize = recAutoRecSize,
  38.                         unsigned short autoReceiveNum = recAutoRecNum,
  39.                         Boolean doUseCName = true);
  40.  
  41.     // creating new sessions
  42.  
  43.     virtual void        NewSession(TelnetSettingsRec& inSettings);
  44.     
  45.  
  46.     // closing windows & sessions
  47.  
  48.     virtual void        AttemptClose(Boolean inRecordIt);
  49.     virtual void        RemoteClose();
  50.  
  51.     // window titling
  52.  
  53.     virtual void        SetWindowTitle(Str255 newTitle);
  54.     virtual void        GetFileName(Str255 theName);
  55.     
  56.     // command/event handling
  57.  
  58.     virtual Boolean        ObeyCommand(CommandT inCommand, void* ioParam);
  59.     virtual void        FindCommandStatus(CommandT inCommand,
  60.                         Boolean& outEnabled, Boolean& outUsesMark,
  61.                         Char16& outMark, Str255 outName);
  62.     virtual Boolean        HandleKeyPress(const EventRecord& inKeyEvent);
  63.  
  64.     // data handling methods
  65.  
  66.     virtual void        HandleNVTChar(uchar theChar);
  67.     virtual void        HandleNVTLine(char* theLine);
  68.  
  69.     // Telnet command handling
  70.  
  71.     virtual void        ReceivedDo(uchar theOption);
  72.     virtual void        ReceivedAYT();
  73.     virtual void        ReceivedEC();
  74.     virtual void        ReceivedEL();
  75.     virtual void        ReceivedSE();
  76.  
  77.     // Telnet option handling
  78.  
  79.     virtual void        OptionTerminalType();
  80.  
  81.     // terminal emulation handling
  82.  
  83.     virtual void        GetTerminalName(short termIndex, char* termStr);
  84.  
  85.     // debugging methods
  86.         // These methods were useful to me in debugging the implementation of various Telnet
  87.         // options. They are enabled by the “Show debugging codes” option of the settings dialog.
  88.  
  89.     virtual void        PrintDebugStr(char* theDebugStr);
  90.     virtual void        PrintDebugCharNum(char theChar, char leftBracket, char rightBracket);
  91.  
  92.  
  93.     // data members
  94.     
  95. protected:
  96.     CTerminalPane*    itsTerminal;                // terminal who displays our I/O
  97.     TelnetSettingsRec    mSettings;                // settings record
  98.     short            itsTermMode;                // which terminal emulation?
  99.  
  100.     // Telnet window description
  101.  
  102.     enum {    
  103.         PPobTelnet = 1026
  104.         // pane descriptions to follow later…
  105.     };
  106.     
  107.     
  108. };
  109.